#ifndef _CONNECTION_HPP_
#define _CONNECTION_HPP_

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include <string>
#include <cstring>
#include <vector>
#include <arpa/inet.h>
#include <stdlib.h>

using namespace std;

class Connection
{
private:
  int sock;
  int bytes;
  struct sockaddr_in server_ipv4;
  struct sockaddr_in6 server_ipv6;
  
  static const int IPV4 = 4;
  static const int IPV6 = 6;
public:
  Connection();
  Connection(string ip_addr, int port);
  int connect_to(string ip_addr, int port, int ip_version);
  int send_data(string data);
  string recv_data();
  void disconnect();
};
#endif
